<nz-layout>
  <nz-sider [nzWidth]="300">
    <nz-divider nzText='【岗位列表】' nzOrientation="left" style="color:rgb(238, 85, 85);font-weight: bold;font-size: 13px;">
    </nz-divider>
    <nz-input-group [nzSuffix]="suffixIcon">
      <input type="text" nz-input placeholder="按岗位名称筛选..." [(ngModel)]="searchValue" />
    </nz-input-group>
    <ng-template #suffixIcon>
      <i nz-icon nzType="search"></i>
    </ng-template>
    <div [ngStyle]="style">
      <nz-tree [nzSearchValue]="searchValue" nzBlockNode [nzData]="nodes" nzShowLine nzExpandAll nzHideUnMatched
        (nzClick)="nzEvent($event)" nzAsyncData="true" [nzTreeTemplate]="nzTreeTemplate"> </nz-tree>


      <ng-template #nzTreeTemplate let-node let-origin="origin">
        <span class="custom-node">
          <span *ngIf="!node.isLeaf">
            <!-- <i nz-icon [nzType]="node.isExpanded ? 'folder-open' : 'folder'" (click)="openFolder(node)"></i> -->
            <span class="folder-name">{{ node.title }}</span>
          </span>
          <span *ngIf="node.isLeaf" (contextmenu)="contextMenu($event, menu,node)">
            <!-- <i nz-icon nzType="file"></i> -->
            <span class="file-name">{{ node.title }}</span>
          </span>
        </span>
      </ng-template>
      <nz-dropdown-menu #menu="nzDropdownMenu">
        <ul nz-menu>
          <li nz-menu-item (click)="cdfz()" [nzDisabled]="gndisabled">功能粘贴</li>
          <li nz-menu-item (click)="ywfz()" [nzDisabled]="ywdisabled">业务粘贴</li>
          <li nz-menu-item (click)="bothfz()" [nzDisabled]="bothdisabled">功能、业务粘贴</li>
          <li nz-menu-item (click)="copy()" [nzDisabled]="copydisabled">复制</li>
        </ul>
      </nz-dropdown-menu>

    </div>
  </nz-sider>
  <nz-content>
    <nz-divider nzText='【岗位详情】' nzOrientation="left" style="color:rgb(238, 85, 85);font-weight: bold;font-size: 13px;">
    </nz-divider>

    <sf #sf mode="edit" [schema]="editSchema" [button]="null" (formChange)="formChanged($event)">
    </sf>
    <div style="text-align:right;padding-right:5px;">
      <button nz-button nzType="primary" [disabled]="isAddUserDisabled" (click)="addYh()"><i nz-icon
          nzType="user"></i>用户添加</button>
      <button nz-button nzType="primary" [disabled]="isAddDisabled" (click)="add(sf.value)"><i nz-icon
          nzType="plus"></i>创建下属岗位</button>
      <button nz-button nzType="primary" [disabled]="isXtDisabled" (click)="addXt()"><i nz-icon
          nzType="file"></i>设置系统权限</button>
      <button nz-button nzType="primary" [disabled]="isYwDisabled" (click)="addYw()"><i nz-icon
          nzType="file"></i>设置业务权限</button>
      <button nz-button #btnSave [disabled]="isSaveDisabled" (click)="save()"><i nz-icon nzType="save"></i>保存修改</button>
      <button nz-button nz-popconfirm nzPopconfirmTitle="是否删除?" nzPopconfirmPlacement="top" (nzOnConfirm)="confirm()"
        (nzOnCancel)="cancel()" nzType="danger" [disabled]="isDelDisabled"><i nz-icon nzType="delete"></i>删除</button>
    </div>
    <nz-divider nzText='【人员列表】' nzOrientation="left" style="color:rgb(238, 85, 85);font-weight: bold;font-size: 13px;">
    </nz-divider>
    <nz-card style="margin-top: 5;">
      <lb-grid #st [columns]="yhColumns" [sname]="params.sname" [queryparas]="params.queryparas"></lb-grid>
    </nz-card>
  </nz-content>
</nz-layout>
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="modalTitle" [nzFooter]="null" (nzOnCancel)="handleCancel()">
  <sf #addSf mode="edit" [schema]="addSchema" [button]="null" [formData]="formData"></sf>
  <div class="modal-footer">
    <button nz-button type="submit" [nzType]="'primary'" (click)="saveAdd(addSf.value)" [disabled]="!addSf.valid">
      <i nz-icon nzType="save"></i>保 存
    </button>
  </div>
</nz-modal>
<nz-modal [(nzVisible)]="chVisible" nzTitle="用户更改" (nzOnCancel)="fwuphandleCancel()" (nzOnOk)="fwuphandleOk()"
  nzWidth="1000">
  <sf #changePop [schema]="changeSchema" [formData]="formData" [button]="null" nzOkText="保存" autocomplete="off">
  </sf>
</nz-modal>
<!-- 设置业务权限 -->
<nz-modal [(nzVisible)]="isCdVisible" [nzTitle]="modalCdTitle" [nzStyle]="{ top: '35px' }"
  (nzOnCancel)="handleCancel()">
  <div style="background-color: #fff;margin-top:5px;padding:5px;height: 400px;overflow: auto;">
    <nz-tree [nzData]="cdnodes" nzCheckable nzMultiple nzCheckStrictly (nzClick)="nzCdEvent($event)"
      (nzExpandChange)="nzCdEvent($event)" (nzCheckBoxChange)="nzCdEvent($event)">
    </nz-tree>
  </div>
  <div *nzModalFooter>
    <button nz-button nzType="default" (click)="handleCancel()">取消</button>
    <button nz-button nzType="primary" (click)="handleOkCd()">确定</button>
  </div>
</nz-modal>

<nz-modal [(nzVisible)]="isYwVisible" [nzTitle]="modalYwTitle" [nzStyle]="{ top: '35px' }"
  (nzOnCancel)="handleCancel()">
  <nz-input-group [nzSuffix]="suffixIcon">
    <input type="text" nz-input placeholder="环节名称筛选..." [(ngModel)]="searchSxValue" />
  </nz-input-group>
  <ng-template #suffixIcon>
    <i nz-icon nzType="search"></i>
  </ng-template>
  <div style="background-color: #fff;margin-top:5px;padding:5px;height: 400px;overflow: auto;">
    <nz-tree [nzData]="sxnodes" [nzSearchValue]="searchSxValue" nzCheckable nzMultiple nzCheckStrictly
      (nzClick)="nzSxEvent($event)" (nzExpandChange)="nzSxEvent($event)" (nzCheckBoxChange)="nzSxEvent($event)">
    </nz-tree>
  </div>
  <div *nzModalFooter>
    <button nz-button nzType="default" (click)="handleCancel()">取消</button>
    <button nz-button nzType="primary" (click)="handleOkYw()">确定</button>
  </div>
</nz-modal>

<nz-modal [(nzVisible)]="isYhVisible" nzTitle="用户新增" [nzOkText]="'保存'" (nzOnCancel)="onCancel()" (nzOnOk)="handleYhOk()"
  [nzWidth]=400>
  <sf #yhsf button="none" [schema]="newYhSchema"></sf>
</nz-modal>